home *** CD-ROM | disk | FTP | other *** search
/ Lewis & Clark Interactive Picture CD / Lewis & Clark Interactive Picture CD.iso / mac / Mac Browser / Portfolio Help / bsscdht2.js < prev    next >
Text File  |  2000-04-26  |  27KB  |  992 lines

  1. //////////BSSCDHTML Section 2//////////
  2. // RoboHELP« Dynamic HTML Effects Script
  3. // Copyright ⌐ 1998-1999 Blue Sky Software Corporation.  All rights reserved.
  4.  
  5. // Version=3.55
  6.  
  7. // Warning:  Do not modify this file.  It is generated by RoboHELP« and changes will be overwritten.
  8.  
  9.  
  10.  
  11. function RemoveNavBar()
  12. {
  13.     // See if we are in a popup and if so remove the NavBar
  14.     if (BSSCPopup_IsPopup()) {
  15.  
  16.         if (gbIE4) {
  17.             var tempColl = document.all.tags("DIV");
  18.             for (var iDiv = 0; iDiv < tempColl.length; iDiv++) {
  19.                 if (tempColl(iDiv).id == "NavBar") {
  20.                     tempColl(iDiv).style.visibility = gBsStyVisHide;
  21.                     if (gbIE5) {
  22.                         tempColl(iDiv).style.position = "absolute";
  23.                     }
  24.                     tempColl(iDiv).style.pixelTop = "-100px";
  25.                     break;
  26.                 }
  27.             }
  28.         } else if (gbNav4) {
  29.             for (var iLayer = 0; iLayer < document.layers.length; iLayer++) {
  30.                 if (document.layers[iLayer].id == "NavBar") {
  31.                     document.layers[iLayer].visibility = gBsStyVisHide;
  32.                 }
  33.             }
  34.             if ((document.images.length > 0) && (document.images[0].src.indexOf('bsscnav1.gif') != -1)) {
  35.                 document.links[0].href = "javascript:void(null);";
  36.             }
  37.         }
  38.     }
  39.     
  40.     return;
  41. }
  42.  
  43.  
  44.  
  45. //////////////////////////////////////////////////////////////////////////////////////////////
  46. //
  47. //    Begin DHTML Popup Functions
  48. //
  49. //////////////////////////////////////////////////////////////////////////////////////////////
  50. //variables used to isolate the browser type
  51. var gBsDoc            = null;            
  52. var gBsSty            = null;
  53. var gBsHtm            = null;
  54. var gBsStyVisShow    = null;
  55. var gBsStyVisHide    = null;
  56. var gBsClientWidth    = 640;
  57. var gBsClientHeight = 480;
  58. var gBsBrowser        = null;
  59.  
  60. //the browser information itself
  61. function _BSPSBrowserItself()
  62. {
  63.     var agent  = navigator.userAgent.toLowerCase();
  64.     this.major = parseInt(navigator.appVersion);
  65.     this.minor = parseFloat(navigator.appVersion);
  66.     this.ns    = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
  67.     this.ns2   = ((this.ns) && (this.major == 2));
  68.     this.ns3   = ((this.ns) && (this.major == 3));
  69.     this.ns4   = ((this.ns) && (this.major >= 4));
  70.     this.ie       = (agent.indexOf("msie") != -1);
  71.     this.ie3   = ((this.ie) && (this.major == 2));
  72.     this.ie4   = ((this.ie) && (this.major >= 4));
  73.     this.op3   = (agent.indexOf("opera") != -1);
  74.  
  75.     if (this.ns4)
  76.     {
  77.         gBsDoc        = "document";
  78.         gBsSty        = "";
  79.         gBsHtm        = ".document";
  80.         gBsStyVisShow    = "show";
  81.         gBsStyVisHide    = "hide";
  82.  
  83.     }
  84.     else if (this.ie4)
  85.     {
  86.         gBsDoc         = "document.all";
  87.         gBsSty         = ".style";
  88.         gBsHtm         = "";
  89.         gBsStyVisShow    = "visible";
  90.         gBsStyVisHide    = "hidden";
  91.     }
  92. }
  93.  
  94. //Here is the browser type 
  95. function _BSPSGetBrowserInfo()
  96. {
  97.     gBsBrowser    = new _BSPSBrowserItself();
  98. }
  99.  
  100. //Get client size info
  101. function _BSPSGetClientSize()
  102. {
  103.     if (gBsBrowser.ns4)
  104.     {
  105.         gBsClientWidth    = innerWidth;
  106.         gBsClientHeight = innerHeight;
  107.  
  108.     }
  109.     else if (gBsBrowser.ie4)
  110.     {
  111.         gBsClientWidth    = document.body.clientWidth;
  112.         gBsClientHeight = document.body.clientHeight;
  113.     }
  114. }
  115.  
  116.  
  117. var gstrPopupID = 'BSSCPopup';
  118. var gstrPopupShadowID = 'BSSCPopupShadow';
  119. var gstrPopupTopicID = 'BSSCPopupTopic';
  120. var gstrPopupIFrameID = 'BSSCPopupIFrame';
  121. var gstrPopupIFrameName = 'BSSCPopupIFrameName';
  122.  
  123. var gstrPopupSecondWindowName = 'BSSCPopup';
  124.  
  125. var    gPopupDiv = null;
  126. var gPopupDivStyle = null;
  127. var    gPopupShadow = null;
  128. var    gPopupTopic = null;
  129. var gPopupIFrame = null;
  130. var gPopupIFrameStyle = null;
  131. var gPopupWindow = null;
  132. var gnPopupClickX = 0;
  133. var gnPopupClickY = 0;
  134.  
  135. var gbPopupTimeoutExpired = false;
  136.  
  137. if (BSSCPopup_IsPopup()) {
  138.     document.write("<base target=\"_parent\">");
  139. }
  140.  
  141. function DHTMLPopupSupport()
  142. {
  143.     if ((gbIE4) && (!gbMac)) {
  144.         return true;
  145.     }
  146.     return false;
  147. }
  148.  
  149.  
  150.  
  151. function BSSCPopup_IsPopup()
  152. {
  153.     if (DHTMLPopupSupport() && (this.name == gstrPopupIFrameName)) {
  154.         return true;
  155.     } else if ((gbNav4 || gbIE4) && (this.name == gstrPopupID)) {
  156.         return true;
  157.     } else {
  158.         return false;
  159.     }
  160. }
  161.  
  162. function _BSSCCreatePopupDiv()
  163. {
  164.     if (gPopupDiv == null) {
  165.         if (DHTMLPopupSupport()) {
  166.             document.write("<DIV ID='" + gstrPopupID + "' STYLE='position:absolute; width:0; height:0; top:-100; left:0; z-index:600; visibility:hidden;'>");
  167.             document.write("<DIV ID='" + gstrPopupShadowID + "' STYLE=\"position:absolute;top:0; left:0;  width:0; height:0; background-color:#C0C0C0;\"></DIV>");
  168.             document.write("<DIV ID='" + gstrPopupTopicID + "' STYLE=\"position:absolute;top:0; left:0;  width:0; height:0; background-color:#FFFFFF;border:1px #000000 outset;\">");
  169.             document.write("<IFRAME ID='" + gstrPopupIFrameID + "' name='" + gstrPopupIFrameName + "' frameborder=0 scrolling=auto></IFRAME>");
  170.             document.write("</DIV></DIV>");
  171.             var tempColl = document.all.tags("DIV");
  172.             for (var iDiv = 0; iDiv < tempColl.length; iDiv++) {
  173.                 if (tempColl(iDiv).id == gstrPopupID) {
  174.                     gPopupDiv = tempColl(iDiv);
  175.                 }
  176.                 if (tempColl(iDiv).id == gstrPopupShadowID) {
  177.                     gPopupShadow = tempColl(iDiv);
  178.                 }
  179.                 if (tempColl(iDiv).id == gstrPopupTopicID) {
  180.                     gPopupTopic = tempColl(iDiv);
  181.                 }
  182.             }
  183.             
  184.             gPopupIFrame = eval("gPopupDiv.document.frames['" + gstrPopupIFrameName + "']");
  185.             gPopupDivStyle = eval("gPopupDiv" + gBsSty);
  186.             gPopupIFrameStyle = eval(gBsDoc + "['" + gstrPopupIFrameName + "']" + gBsSty);
  187.         }
  188.     }
  189. }
  190.  
  191. function BSSCPopup_Timeout()
  192. {
  193.     if ((gPopupIFrame.document.readyState == "complete") &&
  194.         (gPopupIFrame.document.body != null)) {
  195.         BSSCPopup_TimeoutReal();
  196.     } else {
  197.         setTimeout("BSSCPopup_Timeout()", 100);
  198.     }
  199. }
  200.  
  201. function BSSCPopup_TimeoutReal()
  202. {
  203.     window.gbPopupTimeoutExpired = true;
  204.  
  205.     if (gPopupIFrame.document) {
  206.         gPopupIFrame.document.body.onclick = BSSCPopupClicked;
  207.     }
  208.     document.onmousedown = BSSCPopupParentClicked;
  209. }
  210.  
  211. function BSPSPopupTopicWinHelp(strURL)
  212. {
  213.     _BSSCPopup(strURL);
  214.     return;
  215. }
  216.  
  217. function _BSSCPopup(strURL)
  218. {
  219.     if (DHTMLPopupSupport()) {
  220.  
  221.         // If we are already in a popup, replace the contents
  222.         if (BSSCPopup_IsPopup()) {
  223.  
  224.             location.href = strURL;
  225.             parent.window.gbPopupTimeoutExpired = false;
  226.             if (gbMac) {
  227.                 setTimeout("BSSCPopup_AfterLoad()", 400);
  228.             } else {
  229.                 setTimeout("BSSCPopup_AfterLoad()", 100);
  230.             }
  231.  
  232.         } else {
  233.  
  234.             // Load the requested URL into the IFRAME
  235.             gPopupIFrame.location.href = strURL;
  236.             window.gbPopupTimeoutExpired = false;
  237.             if (gbMac) {
  238.                 setTimeout("BSSCPopup_AfterLoad()", 400);
  239.             } else {
  240.                 setTimeout("BSSCPopup_AfterLoad()", 100);
  241.             }
  242.         }
  243.  
  244.     } else {
  245.  
  246.         if (window.name == gstrPopupSecondWindowName) {
  247.             window.location = strURL;
  248.         } else {
  249.  
  250.             BSSCHidePopupWindow();
  251.             var nX = 0;
  252.             var nY = 0;
  253.             var nHeight = 300;
  254.             var nWidth = 400;
  255.             _BSPSGetClientSize();
  256.             if (gBsBrowser.ns4) {
  257.                 nX = window.screenX + (window.outerWidth - window.innerWidth) + window.gnPopupClickX;
  258.                 nY = window.screenY + (window.outerHeight - window.innerHeight) + window.gnPopupClickY;
  259.                 if (nY + nHeight + 40 > screen.availHeight) {
  260.                     nY = screen.availHeight - nHeight - 40;
  261.                 }
  262.                 if (nX + nWidth + 40 > screen.availWidth) {
  263.                     nX = screen.availWidth - nWidth - 40;
  264.                 }
  265.             } else {
  266.                 nX = window.gnPopupClickX;
  267.                 nY = window.gnPopupClickX;
  268.             }
  269.  
  270.             // Launch a separate window
  271.             var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,";
  272.             strParam += "height=" + nHeight + ",width=" + nWidth;
  273.             strParam += ",screenX=" + nX + ",screenY=" + nY;
  274.             window.gPopupWindow = window.open(strURL, gstrPopupSecondWindowName, strParam);
  275.             if (gBsBrowser.ns4) {
  276.                 window.gPopupWindow.captureEvents(Event.CLICK | Event.BLUE);
  277.                 window.gPopupWindow.onclick = NonIEPopup_HandleClick;
  278.                 window.gPopupWindow.onblur = NonIEPopup_HandleBlur;
  279.             }
  280.             else if (gBsBrowser.ie4)
  281.             {
  282.                 window.gPopupWindow.focus();
  283.             }
  284.         }
  285.     }
  286.  
  287.     return;
  288. }
  289.  
  290.  
  291. function NonIEPopup_HandleBlur(e)
  292. {
  293.     window.gPopupWindow.focus();
  294. }
  295.  
  296. function NonIEPopup_HandleClick(e)
  297. {
  298.     // Because navigator will give the event to the handler before the hyperlink, let's
  299.     // first route the event to see if we are clicking on a Popup menu in a popup.
  300.     document.routeEvent(e);
  301.  
  302.     // If a popup menu is active then don't do anything with the click
  303.     if (window.gPopupWindow.gbInPopupMenu) {
  304.         window.gPopupWindow.captureEvents(Event.CLICK);
  305.         window.gPopupWindow.onclick = NonIEPopup_HandleClick;
  306.         return false;
  307.     }
  308.  
  309.     // Close the popup window
  310.     if (e.target.href != null) {
  311.         window.location.href = e.target.href;
  312.         if (e.target.href.indexOf("BSSCPopup") == -1) {
  313.             this.close();
  314.         }
  315.     } else {
  316.         this.close();
  317.     }
  318.     return false;
  319. }
  320.  
  321. function BSSCPopup_AfterLoad()
  322. {
  323.     if ((window.gPopupIFrame.document.readyState == "complete") &&
  324.         (window.gPopupIFrame.document.body != null)) {
  325.         BSSCPopup_ResizeAfterLoad();
  326.     } else {
  327.         setTimeout("BSSCPopup_AfterLoad()", 200);
  328.     }
  329. }
  330.  
  331.  
  332. function BSSCPopup_ResizeAfterLoad()
  333. {
  334.     window.gPopupDivStyle.visibility = gBsStyVisHide;
  335.  
  336.     // Determine the width and height for the window
  337.     var size = new BSSCSize(0, 0);
  338.     BSSCGetContentSize(window.gPopupIFrame, size);
  339.     var nWidth = size.x;
  340.     var nHeight = size.y;
  341.     _BSPSGetClientSize();
  342.     if (nWidth > gBsClientWidth) {
  343.         // Adjust the height by 1/3 of how much we are reducing the width
  344.         var lfHeight = 1.0;
  345.         lfHeight = (((nWidth / (gBsClientWidth - 20.0)) - 1.0) * 0.3333) + 1.0;
  346.         lfHeight *= nHeight;
  347.         nHeight = lfHeight;
  348.         nWidth = gBsClientWidth - 20;
  349.     }
  350.     if (nHeight > gBsClientHeight * .67) {
  351.         nHeight = gBsClientHeight / 2;
  352.     }
  353.     window.gPopupDivStyle.width = nWidth;
  354.     window.gPopupDivStyle.height = nHeight;
  355.  
  356.     // Determine the position of the window
  357.     var nClickX = window.gnPopupClickX;
  358.     var nClickY = window.gnPopupClickY;
  359.     var nTop = 0;
  360.     var nLeft = 0;
  361.  
  362.     if (nClickY + nHeight + 20 < gBsClientHeight + document.body.scrollTop) {
  363.         nTop = nClickY + 10;
  364.     } else {
  365.         nTop = (document.body.scrollTop + gBsClientHeight) - nHeight - 20;
  366.     }
  367.     if (nClickX + nWidth < gBsClientWidth + document.body.scrollLeft) {
  368.         nLeft = nClickX;
  369.     } else {
  370.         nLeft = (document.body.scrollLeft + gBsClientWidth) - nWidth - 8;
  371.     }
  372.     if (nTop <0) nTop  = 1;
  373.     if (nLeft<0) nLeft = 1;
  374.  
  375.  
  376.     window.gPopupDivStyle.left = nLeft;
  377.     window.gPopupDivStyle.top = nTop;
  378.  
  379.     // Set the location of the background blocks
  380.     window.gPopupShadow.style.left = 6;
  381.     window.gPopupShadow.style.top = 6;
  382.     window.gPopupShadow.style.width = nWidth;
  383.     window.gPopupShadow.style.height = nHeight;
  384.     window.gPopupTopic.style.width = nWidth;
  385.     window.gPopupTopic.style.height = nHeight;
  386.  
  387.     if (gbMac) {
  388.         // Total hack on the iMac to get the IFrame to position properly
  389.         window.gPopupIFrameStyle.pixelLeft = 100;
  390.         window.gPopupIFrameStyle.pixelLeft = 0;
  391.         // Explicitly call BSSCOnLoad because the Mac doesn't seem to do it
  392.         window.gPopupIFrame.window.BSSCOnLoad();
  393.     }
  394.     window.gPopupIFrameStyle.width = nWidth;
  395.     window.gPopupIFrameStyle.height = nHeight;
  396.  
  397.     window.gPopupDivStyle.visibility = gBsStyVisShow;
  398.  
  399.     setTimeout("BSSCPopup_Timeout();", 100);
  400.     return false;
  401. }
  402.  
  403.  
  404. function    BSSCSize(x, y)
  405. {
  406.     this.x = x;
  407.     this.y = y;
  408. }
  409.  
  410. function BSSCGetContentSize(thisWindow, size)
  411. {
  412.     if (!((gBsBrowser.ie4) || (gBsBrowser.ns4)))
  413.         return;
  414.  
  415.     if (gbMac) {
  416.         size.x = 300;
  417.         size.y = 300;
  418.         return;
  419.     }
  420.  
  421.     // Resize the width until it is wide enough to handle the content
  422.     // The trick is to start wide and determine when the scrollHeight changes
  423.     // because then we know a scrollbar is necessary. We can then go back
  424.     // to the next widest size (for no scrollbar)
  425.     size.x = 800;
  426.     var y = 1;
  427.     var x = 800;
  428.  
  429.     // This double resize causes the document to re-render (and we need it to)
  430.     thisWindow.resizeTo(1, 1);
  431.     thisWindow.resizeTo(1, 1);
  432.     thisWindow.resizeTo(x, thisWindow.document.body.scrollHeight);
  433.     thisWindow.resizeTo(x, thisWindow.document.body.scrollHeight);
  434.     var miny = thisWindow.document.body.scrollHeight;
  435.     size.y = miny;
  436. //    alert('firstsizex :' + resizeInfo.RstX + "    firstsizey :" + resizeInfo.RstY);
  437.     for (i = 7; i > 0; i--) {
  438.         x = i * 100;
  439.         thisWindow.resizeTo(x, miny);
  440.         thisWindow.resizeTo(x, miny);
  441. //        alert('testsizex :' + x + "    testsizey :" + miny);
  442.         if ((thisWindow.document.body.scrollHeight > miny) ||
  443.             (thisWindow.document.body.scrollWidth > x)) {
  444.             x = (i + 1) * 100;
  445.             thisWindow.resizeTo(x, y);
  446.             thisWindow.resizeTo(x, y);
  447.             size.x = thisWindow.document.body.scrollWidth + 20;
  448.             size.y = thisWindow.document.body.scrollHeight + 20;
  449.             break;
  450.         }
  451.     }
  452.  
  453.     // Handle absurd cases just in case IE flakes
  454.     if (size.y < 100) {
  455.         size.y = 100;
  456.     }
  457. //    alert('sizex :' + size.x + "    sizey :" + size.y);
  458.     thisWindow.resizeTo(size.x, size.y);
  459.     thisWindow.resizeTo(size.x, size.y);
  460.  
  461.     return;
  462. }
  463.  
  464.  
  465.  
  466. function BSSCPopupParentClicked()
  467. {
  468.     BSSCPopupClicked();
  469.     return;
  470. }
  471.  
  472.  
  473. function BSSCPopupClicked()
  474. {
  475.     if (!window.gbPopupTimeoutExpired) {
  476.         return false;
  477.     }
  478.  
  479.     if (gPopupIFrame.window.gbInPopupMenu) {
  480.         return false;
  481.     }
  482.  
  483.     // Give the user a message about javascript calls through objects.
  484.     if ((gPopupIFrame.window.event != null) &&
  485.         (gPopupIFrame.window.event.srcElement != null) &&
  486.         (gPopupIFrame.window.event.srcElement.tagName == "A") &&
  487.         (gPopupIFrame.window.event.srcElement.href.indexOf("javascript:") == 0) &&
  488.         (gPopupIFrame.window.event.srcElement.href.indexOf(".") != -1)) {
  489.         gPopupIFrame.window.event.cancelBubble = true;
  490.         alert('Hyperlinks to objects do not work in popups.');
  491.         return false;
  492.     }
  493.  
  494.     if (gPopupIFrame.document) {
  495.         gPopupIFrame.document.body.onclick = null;
  496.     }
  497.     document.onclick = null;
  498.     document.onmousedown = null;
  499.  
  500.     // Simply hide the popup
  501.     gPopupDivStyle.visibility = gBsStyVisHide;
  502.  
  503.     return true;
  504. }
  505.  
  506.  
  507. //trace the mouse over's position for hotspot
  508. function  BSPSPopupOnMouseOver(event)
  509. {
  510.     if (gBsBrowser.ie4) {
  511.         window.gnPopupClickX = event.clientX + document.body.scrollLeft;
  512.         window.gnPopupClickY = event.clientY + document.body.scrollTop;
  513.     } else if (gBsBrowser.ns4) {
  514.         window.gnPopupClickX = event.pageX;
  515.         window.gnPopupClickY = event.pageY;
  516.     }
  517. }
  518.  
  519. function BSSCHidePopupWindow()
  520. {
  521.     if (window.gPopupWindow != null) {
  522.         if (gBsBrowser.ns4) {
  523.             if ((typeof window.gPopupWindow != "undefined") && (!window.gPopupWindow.closed)) {
  524.                 window.gPopupWindow.close();
  525.                 window.gPopupWindow = null;
  526.             }
  527.         }
  528.     }
  529.  
  530.     return;
  531. }
  532.  
  533. var gbPopupMenuTimeoutExpired = false;
  534. var gbInPopupMenu = false;
  535. var gbPopupMenuTopicList = null;
  536.  
  537. //////////////////////////////////////////////////////////////////////////////////////////
  538. //
  539. // Popup Menu code
  540. //
  541. //////////////////////////////////////////////////////////////////////////////////////////
  542.  
  543.  
  544. function _WritePopupMenuLayer()
  545. {
  546.     document.write("<DIV ID='PopupMenu' STYLE='position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;'></DIV>");
  547.     if (gbNav4) {
  548. //Do not try to write ininle styles for NS!  NS can not handle it and will not stop downloading the html page...
  549. //        document.write(".PopupOver {color:white; background:navy; font-size:9pt; text-decoration:none;}");
  550. //        document.write(".PopupNotOver {color:black; background:#c0c0c0; font-size:9pt; text-decoration:none;}");
  551.     } else if (gbIE4) {
  552.         document.write("<STYLE TYPE='text/css'>");
  553.         if (gbMac) {
  554.             document.write(".PopupOver {font-family:'Arial'; color:white; background:navy; font-size:10pt; text-decoration:none;}");
  555.             document.write(".PopupNotOver {font-family:'Arial'; color:black; background:#c0c0c0; font-size:10pt; text-decoration:none;}");
  556.         } else {
  557.             document.write(".PopupOver {font-family:'Arial'; color:white; background:navy; font-size:8pt; text-decoration:none;}");
  558.             document.write(".PopupNotOver {font-family:'Arial'; color:black; background:#c0c0c0; font-size:8pt; text-decoration:none;}");
  559.         }
  560.         document.write("</STYLE>");
  561.     }
  562. }
  563.  
  564. //Define variable arguments as: strTitle, strUrl
  565. function PopupMenuTopicEntry() 
  566. {
  567.     this.strTitle = PopupMenuTopicEntry.arguments[0];
  568.     this.strURL = PopupMenuTopicEntry.arguments[1];
  569. }
  570.  
  571. // If the topic list is set, it is an array of TopicEntry objects (defined in WebHelp3.js)
  572. function PopupMenu_SetTopicList(aPopupTopicArray)
  573. {
  574.     gbPopupMenuTopicList = aPopupTopicArray;
  575. }
  576.  
  577. //Seek for the bsscright frame 
  578. function _SeekFrameByName( cRoot, strName )
  579. {
  580.     if( cRoot == null )    return null;
  581.     if( cRoot.frames == null )    return null;
  582.     if( cRoot.frames[strName] != null )    return cRoot.frames[strName];
  583.     for (var i=0; i<cRoot.frames.length; i++)
  584.     {
  585.         var cObj = _SeekFrameByName( cRoot.frames(i).document, strName );
  586.         if( cObj != null )        return cObj;
  587.     };
  588.     return null;
  589. }
  590. function _GetFrameByName( cRoot, strName )
  591. {
  592.     if( cRoot == null )    return null;
  593.     var cRet = _SeekFrameByName(cRoot, strName);
  594.     if( cRet != null )    return cRet;
  595.     return _GetFrameByName( cRoot.parent, strName );
  596. }
  597.  
  598. function _PopupMenu_Invoke(fn_arguments)
  599. {
  600.     if ((!gbIE4 && !gbNav4) || ((gbMac) && (gbIE4) && (window.event.srcElement.tagName == "AREA"))) {
  601.     
  602.         var argLen     = fn_arguments.length;
  603.  
  604.         // Create the window that the hyperlinks will go into
  605.         var nHeight = argLen * 15;
  606.         var nWidth = 400;
  607.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=auto";
  608.         strParam += ",height=" + nHeight + ",width=200";
  609.         strParam += ",resizable";
  610.  
  611.         // Create a temporary window first to ensure the real popup comes up on top
  612.         var wndTemp = window.open("", "temp", strParam);
  613.  
  614.         // Create the real popup window
  615.         var wndPopupLinks = window.open("", "popuplinks", strParam);
  616.  
  617.         // Close the temporary
  618.         wndTemp.close();
  619.  
  620.         wndPopupLinks.document.open("text/html");
  621.         wndPopupLinks.document.write("<html><head></head>");
  622.         wndPopupLinks.document.write("<body onBlur=\'self.focus();\'>");
  623.         var strParaLine = "";
  624.         for (var i = 0; i < (argLen - 2) / 2; i++) {
  625.             strParaLine = "";
  626.             strParaLine += "<a href=\"javascript:";
  627.             if (gbIE) {
  628.                 strParaLine += "onBlur=null; ";
  629.             }
  630.             strParaLine += "opener.location=\'";
  631.             strParaLine += fn_arguments[2 * i + 3];
  632.             strParaLine += "\';close();\"";
  633.             if (fn_arguments[1] != '') {
  634.                 strParaLine += " TARGET='" + fn_arguments[1] + "'";
  635.             }
  636.             strParaLine += ">";
  637.             strParaLine += fn_arguments[2 * i + 2];
  638.             strParaLine += "</a>";
  639.             strParaLine += "<br>";
  640.             wndPopupLinks.document.write(strParaLine);
  641.         }
  642.         wndPopupLinks.document.write("</body></html>");
  643.         wndPopupLinks.document.close();
  644.         window.gbInPopupMenu = true;
  645.         if (!gbIE) {
  646.             wndPopupLinks.focus();
  647.         }
  648.  
  649.         return false;
  650.     }
  651.  
  652.     // Make sure we have reasonable arguments
  653.     var argLen = fn_arguments.length;
  654.     if (argLen < 3) {
  655.         return false;
  656.     }
  657.  
  658.     // Check to see if we only have one target
  659.     var strTarget = "";
  660.     if (((argLen < 5) && (isNaN(fn_arguments[2]))) ||
  661.         ((argLen < 4) && (!isNaN(fn_arguments[2])))) {
  662.  
  663.         // Get the place that we will be putting the topic into
  664.         var targetDoc = null;
  665.         if (fn_arguments[1] == '') {
  666.             targetDoc = window.document;
  667.         } else {
  668.             targetDoc = _GetFrameByName( parent, fn_arguments[1] );
  669.             if (targetDoc == null) {
  670.                 targetDoc  = window.document;
  671.             }
  672.             //if (gbIE4) {
  673.             //        targetDoc = eval("top.document.frames['" + fn_arguments[1] + "']");
  674.             //    } else if (gbNav4) {
  675.             //    targetDoc = eval("window.top." + fn_arguments[1] + ".document");
  676.             //}
  677.             strTarget = "TARGET='" + fn_arguments[1] + "'";
  678.         }
  679.         if (isNaN(fn_arguments[2])) {
  680.             targetDoc.location.href = fn_arguments[3];
  681.         } else {
  682.             targetDoc.location.href = gbPopupMenuTopicList[fn_arguments[2]].strURL;
  683.         }
  684.         return false;
  685.     }
  686.     
  687.     var strMenu = "";
  688.     if (gbNav4) {
  689.         strMenu = '<TABLE BORDER="1" CELLSPACING=0 CELLPADDING=3 BGCOLOR="#c0c0c0">';
  690.     } else {
  691.         strMenu = '<TABLE STYLE="border:2px outset white;" CELLSPACING=0';
  692.         if (gbMac) {
  693.             strMenu += ' CELLPADDING=4';
  694.         } else {
  695.             strMenu += ' CELLPADDING=2';
  696.         }    
  697.         strMenu += ' BGCOLOR=#c0c0c0>';
  698.     }
  699.  
  700.     // Add each of the items
  701.     var i = 2;
  702.     while (i <= argLen - 1) {
  703.         strMenu += '<TR><TD><NOBR>'
  704.         // If the destination is a number then look it up in the topic list
  705.         if (isNaN(fn_arguments[i])) {
  706.             strMenu += '<DIV STYLE="padding-left:3pt; padding-right:3pt;"><A HREF="' + fn_arguments[i + 1] + '"' + strTarget;
  707.         } else {
  708.             strMenu += '<DIV STYLE="padding-left:3pt; padding-right:3pt;"><A HREF="' + gbPopupMenuTopicList[fn_arguments[i]].strURL + '"' + strTarget;
  709.         }
  710.         strMenu += ' onclick="PopupMenu_HandleClick(event);"';
  711.         strMenu += ' onmouseover="PopupMenu_Over(event);"';
  712.         strMenu += ' onmouseout="PopupMenu_Out(event);"';
  713.         strMenu += '>';
  714.         if (isNaN(fn_arguments[i])) {
  715.             strMenu += '<SPAN CLASS="PopupNotOver">' + fn_arguments[i] + '</SPAN>';
  716.         } else {
  717.             strMenu += '<SPAN CLASS="PopupNotOver">' + gbPopupMenuTopicList[fn_arguments[i]].strTitle + '</SPAN>';
  718.         }
  719.         strMenu += '</A></DIV></NOBR></TD></TR>';
  720.  
  721.         if (isNaN(fn_arguments[i])) {
  722.             i += 2;
  723.         } else {
  724.             i += 1;
  725.         }
  726.     }
  727.     strMenu += "</TABLE>";
  728.  
  729.     var layerPopup = null;
  730.     var stylePopup = null;
  731.     var nEventX = 0;
  732.     var nEventY = 0;
  733.     var nWindowWidth = 0;
  734.     if (gbIE4) {
  735.  
  736.         layerPopup = document.all["PopupMenu"];
  737.         layerPopup.innerHTML = strMenu;
  738.         stylePopup = layerPopup.style;
  739.  
  740.         _BSPSGetClientSize();
  741.  
  742.         // Get the position of the item causing the event (relative to its parent)
  743.         //if (gbMac) {
  744.         if (true) {
  745.             nEventX = window.event.clientX;
  746.             nEventY = window.event.clientY;
  747.         } else {
  748.             //??? YJ: Can not remember why we calculate envent position by following code...
  749.             //but it is wrong in a case like: CENTER->P->TABLE:
  750.             //the offset positions of TABLE, P and CENTER are same (same offsetTop,offsetLeft)
  751.             //so we get triple times of offset of x and y as we expect... 
  752.  
  753.             nEventX = window.event.srcElement.offsetLeft - document.body.scrollLeft;
  754.             nEventY = window.event.srcElement.offsetTop - document.body.scrollTop;
  755.  
  756.             // Get the location of the parent
  757.             var nParentLocX = 0;
  758.             var nParentLocY = 0;
  759.  
  760.             var ParentItem = window.event.srcElement.offsetParent;
  761.             while (ParentItem != null) {
  762.                 if (ParentItem.offsetLeft)    {
  763.                     nParentLocX += ParentItem.offsetLeft;
  764.                     nParentLocY += ParentItem.offsetTop;
  765.                 }
  766.                 ParentItem = ParentItem.parentElement;
  767.             }
  768.  
  769.             // Adjust the location of the item using the location of the parent(s)
  770.             nEventX += nParentLocX;
  771.             nEventY += nParentLocY;
  772.         }
  773.  
  774.         if (nEventY + layerPopup.scrollHeight + 10 < gBsClientHeight) {
  775.             nEventY += document.body.scrollTop + 10;
  776.         } else {
  777.             nEventY = (document.body.scrollTop + gBsClientHeight) - layerPopup.scrollHeight - 20;
  778.         }
  779.         stylePopup.top = nEventY;
  780.  
  781.         if (nEventX + layerPopup.scrollWidth + 20 > gBsClientWidth) {
  782.             if (gBsClientWidth - layerPopup.scrollWidth < 5) {
  783.                 stylePopup.left = 5;
  784.             } else {
  785.                 stylePopup.left = gBsClientWidth - layerPopup.scrollWidth - 5;
  786.             }
  787.         } else {
  788.             stylePopup.left = nEventX + document.body.scrollLeft + 20;
  789.         }
  790.  
  791.         stylePopup.visibility = "visible";
  792.         document.onclick = PopupMenu_HandleClick;
  793.     } else if (gbNav4) {
  794.         layerPopup = document.layers.PopupMenu;
  795.         layerPopup.visibility = "hide";
  796.         stylePopup = layerPopup.document;
  797.         stylePopup.write(strMenu);
  798.         stylePopup.close();
  799.         var e = fn_arguments[0];
  800.         nEventX = e.pageX;
  801.         nEventY = e.pageY;
  802.         _BSPSGetClientSize();
  803.         if (nEventY + layerPopup.clip.height + 20 < window.pageYOffset + gBsClientHeight) {
  804.             nEventY += 20;
  805.         } else {
  806.             nEventY = gBsClientHeight + window.pageYOffset- layerPopup.clip.height - 20;
  807.         }
  808.         layerPopup.top = nEventY;
  809.  
  810.         if (nEventX + layerPopup.clip.width + 20 > gBsClientWidth + window.pageXOffset) {
  811.             if (gBsClientWidth + window.pageXOffset - layerPopup.clip.width < 20) {
  812.                 nEventX = 5;
  813.             } else {
  814.                 nEventX = gBsClientWidth + window.pageXOffset - layerPopup.clip.width - 20;
  815.             }
  816.         } else {
  817.             nEventX += 20;
  818.         }
  819.  
  820.         layerPopup.left = nEventX;
  821.  
  822.         layerPopup.visibility = "show";
  823.  
  824. //        window.captureEvents(Event.CLICK | Event.MOUSEDOWN);
  825.         window.captureEvents(Event.MOUSEDOWN);
  826. //        window.onclick = PopupMenu_HandleClick;
  827.         window.onmousedown = PopupMenu_HandleClick;
  828.     }
  829.  
  830.     window.gbInPopupMenu = true;
  831.     window.gbPopupMenuTimeoutExpired = false;
  832.     setTimeout("PopupMenu_Timeout();", 100);
  833.     return false;
  834. }
  835.  
  836.  
  837. function PopupMenu_Timeout()
  838. {
  839.     window.gbPopupMenuTimeoutExpired = true;
  840. }
  841.  
  842. function PopupMenu_Over(e)
  843. {
  844.     if (gbIE4) {
  845.         e.srcElement.className = "PopupOver";
  846.     } else if (gbNav4) {
  847. //        this.bgColor = "red";
  848. //        e.target.document.className = "PopupOver";
  849.     }
  850.     return;
  851. }
  852.  
  853. function PopupMenu_Out(e)
  854. {
  855.     if (gbIE4) {
  856.         e.srcElement.className = "PopupNotOver";
  857.     } else if (gbNav4) {
  858.         this.bgColor = "#f0f0f0";
  859.     }
  860.     return;
  861. }
  862.  
  863.  
  864. function PopupMenu_HandleClick(e)
  865. {
  866.     if (!window.gbPopupMenuTimeoutExpired) {
  867.         return;
  868.     }
  869.  
  870.     window.gbInPopupMenu = false;
  871.  
  872.     if (gbNav4) {
  873. //        window.releaseEvents(Event.CLICK);
  874.         window.releaseEvents(Event.MOUSEDOWN);
  875.     }
  876.  
  877.     var layerPopup = null;
  878.     var stylePopup = null;
  879.     if (gbIE4) {
  880.         layerPopup = document.all["PopupMenu"];
  881.         stylePopup = layerPopup.style;
  882.         stylePopup.visibility = "hidden";
  883.     } else if (gbNav4) {
  884.         layerPopup = document.layers.PopupMenu;
  885.         layerPopup.visibility = "hide";
  886.     }
  887.  
  888.     return;
  889. }
  890.  
  891. // This function should be deleted when all old projects are cleaned up
  892. function BSPSWritePopupFrameForIE4()
  893. {
  894.     return false;
  895. }
  896.  
  897. /////////////////////////////////////////////////////////////////////
  898. function BSSCPopup_ClickMac()
  899. {
  900.     if ((!DHTMLPopupSupport()) && (gbIE4))
  901.     {    
  902.         var bClickOnAnchor = false;
  903.         var el;
  904.         if ((window.event != null) &&
  905.             (window.event.srcElement != null))
  906.         {
  907.             el = window.event.srcElement;
  908.             while (el != null)
  909.             {
  910.                 if ((el.tagName == "A") || (el.tagName == "AREA"))     {
  911.                     bClickOnAnchor = true;
  912.                     break;
  913.                 }
  914.                 if (el.tagName == "BODY") {
  915.                     break;
  916.                 }
  917.                 el = el.parentElement;
  918.             }
  919.         }
  920.         if (BSSCPopup_IsPopup())
  921.         {
  922.             if (!bClickOnAnchor) {
  923.                 parent.window.gPopupWindow = null;
  924.                 self.close();
  925.             }
  926.         }
  927.         else
  928.         {
  929.             bClosePopupWindow = true;
  930.             if ((bClickOnAnchor) &&
  931.                 (el.href) &&
  932.                 (el.href.indexOf("javascript:BSSCPopup") != -1))
  933.             {
  934.                 bClosePopupWindow = false;
  935.             }
  936.             if (bClosePopupWindow)
  937.             {
  938.                 if (window.gPopupWindow != null)
  939.                 {
  940.                     var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=300,width=400";
  941.                     window.gPopupWindow = window.open("", gstrPopupSecondWindowName,strParam);
  942.                     window.gPopupWindow.close();
  943.                     window.gPopupWindow = null;
  944.                 }
  945.             }
  946.         }
  947.     }
  948.  }
  949.  
  950. //////////////////////////////////////////////////////////////////////
  951.  
  952. _BSPSGetBrowserInfo();
  953.  
  954. function _BSSCOnLoad()
  955. {
  956.     if (!gbIE4 && !gbNav4)
  957.         return;
  958.  
  959.     // Make everything visible in navigator
  960.     if (gbNav4) {
  961.         // Make some special effects items visible
  962.         for (var iLayer = 0; iLayer < document.layers.length; iLayer++) {
  963.             document.layers[iLayer].visibility = gBsStyVisShow;
  964.             document.layers[iLayer].left = 0;
  965.         }
  966.     }
  967.  
  968.     // Remove the NavBar if necessary
  969.     RemoveNavBar();
  970.         
  971.     // Don't continue without IE4
  972.     if (gbIE4) {
  973.         HHActivateComponents();
  974.         doStaticEffects();
  975.         startAnimationSet(0);
  976.     }
  977. }
  978.  
  979. function _BSSCOnUnload()
  980. {
  981. }
  982.  
  983. function _BSSCOnClick()
  984. {
  985.     if (!gbIE4)
  986.         return;
  987.  
  988.     BSSCPopup_ClickMac();
  989.     startNextAnimationSet();
  990. }
  991.  
  992.